package com.windowes.weichang.controller.manage;

import com.windowes.weichang.common.ServerResponse;
import com.windowes.weichang.pojo.Issue;
import com.windowes.weichang.service.IssueService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/***
 *
 * @author: yangqing
 * @email: qing.yang@bangdao-tech.com
 * @createTime: 2018/6/2 下午8:54
 * @description:
 *
 **/
@Api(description = "常见问题相关API")
@RestController
@RequestMapping("issue")
public class IssueController {

    @Autowired
    IssueService issueService;

    @ApiOperation(value = "添加问题", notes = "")
    @PostMapping("addOrUpdate")
    public ServerResponse addOrUpdate(@RequestBody Issue issue) {
        return issueService.addOrUpdate(issue);
    }

    @ApiOperation(value = "常见问题列表", notes = "")
    @GetMapping("list")
    public ServerResponse list(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
                               @RequestParam(value = "pageSize", defaultValue = "15") int pageSize) {
        return issueService.list(pageNo, pageSize);
    }

    @ApiOperation(value = "删除常见问题", notes = "")
    @PostMapping("delete")
    public ServerResponse delete(Integer id) {
        return issueService.delete(id);
    }


}
